package com.logica.tutorial.web;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import org.apache.wicket.AttributeModifier;
import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.WebSocketRequestHandler;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.ajax.markup.html.form.AjaxButton;
import org.apache.wicket.extensions.ajax.markup.html.tabs.AjaxTabbedPanel;
import org.apache.wicket.extensions.markup.html.tabs.AbstractTab;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.Model;
import org.apache.wicket.protocol.ws.api.IWebSocketConnection;
import org.apache.wicket.protocol.ws.api.SimpleWebSocketConnectionRegistry;
import org.apache.wicket.protocol.ws.api.WebSocketBehavior;
import org.apache.wicket.protocol.ws.api.message.ClosedMessage;
import org.apache.wicket.protocol.ws.api.message.ConnectedMessage;
import org.apache.wicket.protocol.ws.api.message.TextMessage;
import org.apache.wicket.util.visit.IVisit;
import org.apache.wicket.util.visit.IVisitor;

/* Useful links:
 * https://github.com/martin-g/wicket-native-websocket-example
 * https://cwiki.apache.org/confluence/display/WICKET/Wicket+Native+WebSockets
 * http://wicketinaction.com/2012/07/wicket-6-native-websockets/ */
public class HomePage extends WebPage {
	private static final long serialVersionUID = -7981342191491938344L;

	@SuppressWarnings("unchecked")
	public HomePage() {
//		List<AbstractTab> tabs = new ArrayList<AbstractTab>();
//		tabs.add(new AbstractTab(new Model("Add")) {
//			public Panel getPanel(String panelId) {
//				return new GamePanel(panelId);
//			}
//		});

//		tabs.add(new AbstractTab(new Model("Search")) {
//			public Panel getPanel(String panelId) {
//				return new SearchPage(panelId);
//			}
//		});

//		AjaxTabbedPanel ajaxTabbedPanel = new AjaxTabbedPanel("tabs", tabs);
		// ajaxTabbedPanel.get(0).add(new AttributeAppender("onclick", new
		// Model("myTableSortingScript();"), ";"));
//		add(ajaxTabbedPanel);
		GamePanel gamePanel = new GamePanel("gamePanel");
		add(gamePanel);
	}
}
